<?php
error_reporting(E_ERROR );
class tpl
{
	var $params = array();
	var $tpl;
	var $html;

	function set_tpl($tpl)
	{
		$this->tpl = $tpl;
		return true;
	}

	function set_param($variable, $value)
	{
		if(is_array($value))
		{
			$variable2 = '';
			foreach($value as $key => $val)
				$variable2 .= $val.', ';
			$this->params[$variable] = $variable2;
		}
		else
			$this->params[$variable] = $value;
		return true;
	}

	function display()
	{
		$this->html = implode("", file($this->tpl));
		foreach($this->params as $key => $value)
		{
			$temp = '['.$key.']';
			$this->html = str_replace($temp, $value, $this->html);
		}
		return $this->html;
	}
}

?>